package com.edu.test;

import com.edu.bean.Book;
import com.edu.mapper.BookMapper;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Before;
import org.junit.Test;

import java.io.*;

/**
 * @Author:mx
 * @Date:2025/10/20-17:04:11
 */
public class MyTest02 {


    @Test
    public void test01() throws IOException {
       Book book = new Book();
       book.setBookId(1);
       book.setBookName("h1");
       book.setBookType("科幻");
       book.setBookWriter("刘慈欣");
       book.setBookPrice(35.00);
       OutputStream oos =new FileOutputStream("abc");
       ObjectOutputStream objectOutputStream = new ObjectOutputStream(oos);
       objectOutputStream.writeObject(book);
    }

    @Test
    public void test02() throws IOException, ClassNotFoundException {
        InputStream ins = new FileInputStream("abc");
        ObjectInputStream ois = new ObjectInputStream(ins);
        Object o = ois.readObject();
        System.out.println(o);
    }


}
